﻿package com.tangchao.client.sdh.view.selectColor
{
	import com.tangchao.client.sdh.definition.DFCardColor;
	import com.tangchao.client.sdh.definition.DFState;
	import com.tangchao.client.sdh.event.SelectColorEvent;
	import com.tangchao.client.sdh.view.SanDaHaPanel;
	
	import flash.display.MovieClip;

	public class SelectColorPanel extends MovieClip
	{
		private var _canSelect:Boolean = false;
		private var _parentUI:SanDaHaPanel;
		
		private var _mcFangkuai:BaseColor;
		private var _mcHongtao:BaseColor;
		private var _mcCaohua:BaseColor;
		private var _mcHeitao:BaseColor;
		
		public function SelectColorPanel()
		{
			super();
			
			_mcFangkuai = getChildByName("mcFangKuai") as BaseColor;
			_mcFangkuai.parentUI = this;
			
			_mcHongtao = getChildByName("mcHongTao") as BaseColor;
			_mcHongtao.parentUI = this;
			
			_mcCaohua = getChildByName("mcCaoHua") as BaseColor;
			_mcCaohua.parentUI = this;
			
			_mcHeitao = getChildByName("mcHeiTao") as BaseColor;
			_mcHeitao.parentUI = this;
			
		}
		
		public function set parentUI(ui:SanDaHaPanel):void
		{
			_parentUI = ui;
		}
		
		public function setStat(canSelect:Boolean):void
		{
			_canSelect = canSelect;
		}
		
		public function onSelectColor(color:int, posX:int, posY:int):void
		{
			if(_parentUI && _canSelect)
			{
				_canSelect = false;
				_parentUI.onSelectColor(color, x+posX, y+posY);
				
			}
		}
		
	}
}